package cn.csg.iotplatform.module.system.dal.mysql.menu;

import cn.csg.iotplatform.framework.mybatis.core.mapper.BaseMapperX;
import cn.csg.iotplatform.module.system.controller.admin.menu.vo.MenuCollectionVO;
import cn.csg.iotplatform.module.system.dal.dataobject.menu.MenuCollectionDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Description TODO
 * @Author super huang
 * @Date 2024-05-09 15:02
 */
@Mapper
public interface MenuCollectionMapper extends BaseMapperX<MenuCollectionDO> {

    @Select("select id parent_menu_id , name parent_menu_name, level from SYSTEM_MENU " +
            "where DELETED = 0 and id != #{id} START WITH id = #{id} CONNECT BY PRIOR parent_id =  id")
    List<MenuCollectionVO> getMaxparentData(@Param("id") Integer id);
}
